<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>栏目列表</title>
	<link rel="stylesheet" href="__PUBLIC__/Admin/Css/common.css" />
	<script type="text/javascript" src='__PUBLIC__/Admin/Js/jquery-1.8.2.min.js'></script>
	<script type="text/javascript" src='__PUBLIC__/Admin/Js/common.js'></script>
	<script type="text/javascript">
		$(function(){
			$('tr[pid!=0]').hide();
			$('.open').toggle(function(){
				var index = $(this).parents('tr').attr('id');
				$('tr[pid='+index+']').show(500);
				$(this).html('收起');
				$(this).css('background-color','#ccc');
			},function(){
				var index = $(this).parents('tr').attr('id');
				
				$('tr[pid='+index+']').hide(500);
				$(this).html('展开');
				$(this).css('background-color','');
			});
		})
	</script>
</head>
<body>
	<div class='status'>
		<span>栏目列表</span>		
	</div>
	<form action="{:U('sortCate')}" method="post">
	<table class='table'>	
		<tr pid='0'>
			<th>栏目级别</th>		
			<th>ID</th>
			<th>栏目名称</th>			
			<th><input style="height:30px;cursor: pointer;" type="submit" value="排序"/></th>
			<th>操作</th>
		</tr>
		<foreach name='cate' item='v'>
			<tr id="{$v.id}" pid="{$v.pid}">
				<td width='80' align='center'>{$v.level}&nbsp;&nbsp;<span class="open" style="border: 1px solid #ccc;padding: 5px;border-radius: 5px;">展开</span></td>
				<td width='50' align='center'>{$v.id}</td>
				<td>{$v.html}{$v.name}</td>				
				<td width='80' align='center'>
					<input type="text" name="{$v.id}" value="{$v.sort}" />
				</td>				
				<td width='100' align='center'>
						<a href="{:U('addCate',array('pid'=>$v['id']))}" class='add lock'>添加子栏目</a>
						[<a href="{:U('edit',array('id'=>$v['id']))}" >修改</a>]&nbsp;&nbsp;&nbsp;
						[<a href="{:U('delCate',array('id'=>$v['id']))}" >删除</a>]
					</if>
				</td>
			</tr>
		</foreach>		
	</table>
	</form>
</body>
</html>